home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / dev / e / AEPD09.lha / EPD09 / Amiga_E-Programme / ESEE / GoldED / ARexx / CompileE.ged next >
Text File  |  1994-08-18  |  3KB  |  115 lines

  1. /* $VER: CompileE.ged v0.9 (16-Sep-93) © 1993 by Leon Woestenberg
  2. */
  3.  
  4. /* Set E Compiler pathname here */
  5. ec = 'ec:ec >T:Eerror'
  6.  
  7. options results
  8. signal on error
  9. if (left(address(), 6) ~= "GOLDED") then address 'GOLDED.1'
  10. 'LOCK CURRENT QUIET'
  11. if rc then do
  12.   exit
  13. end
  14. 'QUERY ANYTEXT'
  15. if (result='TRUE') then
  16.  do /* there is text */
  17.   'QUERY DOC'
  18.   'QUERY DOC VAR FILEPATH'
  19.   if (upper(right(result,2)) ~= '.E') then do
  20.     'REQUEST TITLE="AmigaE Compiler Request" BODY="AmigaE sources must have extension ''.e''"'
  21.     'UNLOCK'
  22.     exit
  23.   end
  24.   'QUERY MODIFY'
  25.   if (result='TRUE') then 'SAVE ALL'
  26.   nosuffix = LEFT(FILEPATH,LENGTH(FILEPATH)-2)
  27.   address command ec nosuffix
  28.  end
  29. else
  30.  do /* there is no text */
  31. end
  32. 'UNLOCK'
  33. exit
  34.  
  35. /* Parse error, show it, and exit */
  36. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  37.  
  38. error:
  39. ok = open(filehandler,'T:Eerror','Read')
  40. if ok = 0 then
  41.  do
  42.   'REQUEST TITLE="AmigaE Compiler Script Error" BODY="Could not read E Compiler error output"'
  43.  end
  44. else
  45.  do
  46.   linestring=''
  47.   withstring=''
  48.   errorstring=''
  49.   errortext=''
  50.   dummy = readln(filehandler)
  51.   DO WHILE ~EOF(filehandler)
  52.     line  = readln(filehandler)
  53.     /* index does the trick :o) */
  54.     /* ~~~~~~~~~~~~~~~~~~~~~~~~ */
  55.     SELECT
  56.     WHEN INDEX(line,'ERROR:')~=0 THEN
  57.     DO
  58.  
  59.       parse var line dummy ': ' errorstring
  60.       errorstring=strip(errorstring)
  61.  
  62.       parse var errorstring left '"' right
  63.       do while (right ~= '')
  64.         errorstring = left || '`' || right
  65.         parse var errorstring left '"' right
  66.       end
  67.  
  68.     END
  69.     WHEN FIND(line,'WITH:')~=0 THEN
  70.     DO
  71.       
  72.       parse var line dummy ': ' withstring
  73.       withstring=strip(withstring)
  74.  
  75.       parse var withstring left '"' right
  76.       do while (right ~= '')
  77.         errorstring = left || '`' || right
  78.         parse var errorstring left '"' right
  79.       end
  80.  
  81.     END
  82.     WHEN FIND(line,'LINE ')~=0 THEN
  83.     DO
  84.       
  85.       parse var line nodummy ': ' linestring
  86.       parse var nodummy dummy 'LINE ' errorline
  87.       linestring=strip(linestring)
  88.  
  89.       parse var linestring left '"' right
  90.       do while (right ~= '')
  91.         errorstring = left || '''' || right
  92.         parse var errorstring left '"' right
  93.       end
  94.     END
  95.     OTHERWISE
  96.       NOP
  97.     END
  98.   END
  99.   errortext='Line '||errorline
  100.   if linestring ~= '' then do
  101.     errortext = errortext||': '||linestring
  102.   end
  103.   if errorstring ~= '' then do
  104.     errortext = errortext||'|'||'Error: '||errorstring
  105.   end
  106.   if withstring ~= '' then do
  107.     errortext = errortext||'|'||'With : '||withstring
  108.   end
  109.   'GOTO LINE='||errorline
  110.   'REQUEST BODY="' || errortext || '"'
  111. end
  112. ok = close(filehandler)
  113. 'UNLOCK'
  114. exit
  115.